<template>
    <div class="w-full">
        <div class="chat-quote">
            <div class="mb-15 f-14 f-bold">引用</div>
            <div v-for="item in list" :key="item.id" class="quote-item" @click="handleQuote(item)">
                <img src="@/assets/images/chat/ai_icon11.png" alt="" class="icon">
                <div class="name">{{ item.document_name }}</div>
            </div>
        </div>
        <ChatQuoteView ref="chatQuoteViewRef" />
    </div>
</template>
<script setup>
import ChatQuoteView from "./ChatQuoteView.vue";

const props = defineProps({
    list: {
        type: Array,
        default: () => []
    }
})
const chatQuoteViewRef = ref(null)
const handleQuote = (item) => {
    chatQuoteViewRef.value.open(item)
}

</script>
<style scoped lang="scss">
.w-full {
    width: 100%;
}

.chat-quote {
    padding: 12px;
    font-size: 14px;
    color: #333333;
    width: 100%;
    margin-top: 30px;
    border-top: 1px solid #e2e2e2;

    .quote-item {
        display: flex;
        align-items: center;
        margin-bottom: 20px;
        justify-content: flex-start;
        cursor: pointer;

        .icon {
            width: 14px;
            height: 16px;
            margin-right: 8px;
        }

        .name {
            flex: 1;
            width: 150px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: #666;

            &:hover {
                color: #000;
            }
        }


        &:last-child {
            margin-bottom: 0;
        }
    }
}
</style>
